//
//  SendRequest.h
//  NewYiYiPai
//
//  Created by 程明 on 16/5/19.
//  Copyright © 2016年 程明. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Reachability.h"

typedef void( ^ CMResponseSuccess)(id response);
typedef void( ^ CMResponseFail)(NSError *error);

typedef void( ^ CMUploadProgress)(int64_t bytesProgress,
                                  int64_t totalBytesProgress);

typedef void( ^ CMDownloadProgress)(int64_t bytesProgress,
                                    int64_t totalBytesProgress);
@interface SendRequest : NSObject

////配置
//+(AFHTTPSessionManager *)ykGetAFManager;

//get请求
+(void)getWithURL:(NSString*)url params:(NSDictionary*)params withCookie:(BOOL )isNeed success:(CMResponseSuccess)cmSuccess fail:(CMResponseFail)cmFail;


//post请求
+(void)postWithURL:(NSString*)url params:(NSDictionary*)params withCookie:(BOOL )isNeed success:(CMResponseSuccess)cmSuccess fail:(CMResponseFail)cmFail;

//update请求
+(void)uploadWithImage:(NSData*)image url:(NSString*)url filename:(NSString*)filename name:(NSString*)name  params:(NSDictionary *)params success:(CMResponseSuccess)success fail:(CMResponseFail)fail;


//download请求

+(void)downloadWithUrl:(NSString *)url saveToPath:(NSString *)saveToPath  success:(CMResponseSuccess )success failure:(CMResponseFail )fail;

+ (BOOL)isExistenceNetwork;

+ (void)isHaveNetworkWithBlock:(void(^)(BOOL isHave))cheakBlock;

//获取凭证专用
+(void)getAccesstokenWithURL:(NSString*)url params:(NSDictionary*)params success:(CMResponseSuccess)cmSuccess fail:(CMResponseFail)cmFail;

@end
